<script lang="ts" setup>
import { useUserAuthorizationStore } from "../store/userAuthorization"

const { common, editDialog } = useUserAuthorizationStore()
</script>

<template>
  <t-dialog
    v-model:visible="editDialog.visible"
    :footer="false"
    destroyOnClose
    header="修改授权"
  >
    <t-row style="padding:10px">
      <t-form :data="common.formData" label-width="80px" label-align="right" style="width: 100%"
              @submit="editDialog.edit"
              :rules="common.rules"
      >
        <t-form-item label="用户ID">
          <t-input v-model="common.formData.user_id" placeholder="请输入用户ID" />
        </t-form-item>

        <t-form-item label="验证方式">
          <t-select v-model="common.formData.type" :options="common.typeOptions" />
        </t-form-item>

        <t-form-item label="授权主体"
                     name="body">
          <t-input placeholder="请输入授权域名或IP" v-model="common.formData.body"/>
        </t-form-item>
        <t-divider />

        <t-form-item style="display:flex;justify-content: right">
          <t-space>
            <t-button variant="outline" @click="editDialog.visible = false">取消</t-button>
            <t-button theme="primary" type="submit" :loading="editDialog.loading">确定</t-button>
          </t-space>
        </t-form-item>

      </t-form>
    </t-row>
  </t-dialog>
</template>

<style lang="less" scoped>

</style>
